<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html">

    <body>

        <ui:composition template="./../resources/template/template.xhtml">

            <ui:define name="content">

                <h:form >

                    <p:panelGrid columns="1" >
                        <f:facet name="header" >
                            <p:outputLabel value="Analysis" ></p:outputLabel>
                        </f:facet>

                        <p:panelGrid columns="2" >
                            <p:outputLabel value="From" ></p:outputLabel>
                            <p:calendar value="#{analysisController.fromDate}"  pattern="dd MMMM yyyy"></p:calendar>

                            <p:outputLabel value="To" ></p:outputLabel>
                            <p:calendar value="#{analysisController.toDate}" pattern="dd MMMM yyyy" ></p:calendar>

                            <p:outputLabel value="Item" ></p:outputLabel>
                            <p:autoComplete completeMethod="#{analysisController.completeBilledItems}"
                                            value="#{analysisController.item}"
                                            var="i" minQueryLength="4"
                                            itemLabel="#{i.name}"
                                            itemValue="#{i}" >
                            </p:autoComplete>




                        </p:panelGrid>

                        <p:panelGrid columns="2" >
                            <p:commandButton value="Download Pharmacy Item Sale"
                                             ajax="false"
                                             action="#{analysisController.createPharmacyBillItemSale()}"
                                             >
                            </p:commandButton>
                            
                            
                        </p:panelGrid>






                    </p:panelGrid>


                </h:form>

                <h:panelGrid >
                    <h:form >

                        <p:poll update="msg" ></p:poll>
                        <p:outputLabel value="#{analysisController.message}" id="msg" escape="false" ></p:outputLabel>

                    </h:form>

                </h:panelGrid>





            </ui:define>

        </ui:composition>

    </body>
</html>
